package com.mccrea.pattern.factory.factorymethod.pizzastore.order;

import com.mccrea.pattern.factory.factorymethod.pizzastore.pizza.Pizza;
import com.mccrea.pattern.factory.util.InputUtil;


/**
 * @Classname OrderPizza
 * @Description 工厂方法订单
 * @Date 2021/5/7 0007 18:39
 * @Created by Mccrea_Gao
 */
public abstract class OrderPizza {


    public abstract Pizza createPizza(String orderType);

    public OrderPizza() {
        String type;
        Pizza pizza;
        do {
            type = InputUtil.getType();
            pizza = createPizza(type);
            if (pizza != null) {
                pizza.prepare();
                pizza.bake();
                pizza.cut();
                pizza.box();
            } else {
                System.out.println("没有指定pizza");
                break;
            }
        } while (true);
    }


}
